home *** CD-ROM | disk | FTP | other *** search
- diff --unified --new-file ../qmail-1.01-unmodified/qmail-smtpd.c ./qmail-smtpd.c
- --- ../qmail-1.01-unmodified/qmail-smtpd.c Tue Apr 15 07:05:23 1997
- +++ ./qmail-smtpd.c Wed Sep 10 12:25:40 1997
- @@ -62,6 +62,9 @@
- stralloc helohost = {0};
- stralloc mailfrom = {0};
- stralloc rcptto = {0};
- +stralloc relayclients = {0};
- +stralloc relaydomains = {0};
- +struct constmap maprelayclients, maprelaydomains;
- int seenmail = 0;
-
- stralloc addr = {0}; /* will be 0-terminated, if addrparse returns 1 */
- @@ -80,6 +83,9 @@
-
- void getenvs()
- {
- + unsigned short int error = 0;
- + unsigned int i, len;
- +
- remoteip = env_get("TCPREMOTEIP");
- if (!remoteip) remoteip = "unknown";
- local = env_get("TCPLOCALHOST");
- @@ -89,6 +95,65 @@
- if (!remotehost) remotehost = "unknown";
- remoteinfo = env_get("TCPREMOTEINFO");
- relayclient = env_get("RELAYCLIENT");
- + if (! relayclient)
- + {
- + /* Attempt to look up the IP number in control/relayclients. */
- + switch (control_readfile (&relayclients, "control/relayclients", 0))
- + {
- + case -1:
- + if (errno == error_nomem)
- + outofmem ();
- + /* Fall through. */
- +
- + case 0:
- + error = 1;
- + break;
- +
- + case 1:
- + if (!constmap_init (&maprelayclients, relayclients.s, relayclients.len, 1))
- + outofmem ();
- + break;
- + }
- +
- + if (! error)
- + {
- + for (i = len = str_len (remoteip); i > 0; i --)
- + if ((i == len) || (remoteip[i - 1] == '.'))
- + if ((relayclient = constmap (&maprelayclients, remoteip, i)))
- + break;
- + }
- + }
- +
- + error = 0;
- + if (! relayclient)
- + {
- + /* Attempt to look up the host name in control/relaydomains. */
- + switch (control_readfile (&relaydomains, "control/relaydomains", 0))
- + {
- + case -1:
- + if (errno == error_nomem)
- + outofmem ();
- + /* Fall through. */
- +
- + case 0:
- + error = 1;
- + break;
- +
- + case 1:
- + if (!constmap_init (&maprelaydomains, relaydomains.s, relaydomains.len, 1))
- + outofmem ();
- + break;
- + }
- +
- + if (! error)
- + {
- + for (i = 0, len = str_len (remotehost); i <= len; i ++)
- + if ((i == 0) || (i == len) || (remotehost[i] == '.'))
- + if ((relayclient = constmap (&maprelaydomains, remotehost + i, len - i)))
- + break;
- + }
- + }
- +
- dohelo(remotehost);
- }
-
-